﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApplication1.Forms
{
    public partial class FormShow : Form
    {
        public FormShow()
        {
            InitializeComponent();
        }


        private void button1_Click(object sender, EventArgs e)
        {
            MessageBox.Show("简单提示", "信息提示");
        }

        private void button2_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("问询提示", "信息提示", MessageBoxButtons.YesNo);
            //1.DialogResult属性用于获取或设置MessageBox.Show()方法返回的一个值，该值在单击按钮式返回到父父窗体
            //2.MessageBoxButtons.YesNo标识提示信息为"是"，“否”两种按钮之一
            if (result == DialogResult.Yes)
            {
                label1.Text = "选择了Yes";
            }
            if (result == DialogResult.No)
            {
                label1.Text = "选择了No";
            }

        }
        private void button3_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("复杂提示","信息提示",MessageBoxButtons.YesNoCancel,MessageBoxIcon.Question
                ,MessageBoxDefaultButton.Button3,MessageBoxOptions.RightAlign);
            //1.MessageBoxButtons.YesNoCancel 参数标识按钮为 “是”、“否”、“取消” 3种状态按钮之一
            //2.MessageBoxIcon.Question 按钮为“问题图标”按钮
            //3.MessageBoxDefaultButton.Button3 表示默认“取消”按钮为默认触发按钮
            //4.MessageBoxOptions.RightAlgin表示对话框提示信息居右对齐
            if (result == DialogResult.Yes)
            {
                label1.Text = "选择Yes";
            }
            if (result == DialogResult.No)
            {
                label1.Text = "选择了No";
            }
            if (result == DialogResult.Cancel)
            {
                label1.Text = "选择了Cancel";
            }

        }

        private void button4_Click(object sender, EventArgs e)
        {
            FormMain2 fm2 = new FormMain2();//实例化其他窗口
            //this.Visible = false;//将当前窗口设置为不可视，如果不这样处理测系统报错
            fm2.ShowDialog();//打开窗口
            this.Visible = true;
        }
    }
}
